/**
 * WTF Engine
 *
 * License... etc.
 **
 * GUI- Scripting support
 **
 * Authors: Sean Micklethwaite
 **/

#include "gui.h"
#include "scripting.h"
#include "gui_console.h"

using namespace WtfEngine;
using namespace WtfGui;
using namespace boost::python;


class GraphDataWrapper: public GcObject, public virtual IGraphData, public boost::python::wrapper<IGraphData> {
public:
	int getNumValues() {
		//try{
			return this->get_override("GetNumValues")();
			//object r = f();
			//int rv = extract<int>(r);
			//return rv;
		//}catch(const boost::python::error_already_set & e){
		//	PyErr_Print();
		//};
	};
	WtfEngine::String getLabel(int x){
		try{
			object r = this->get_override("GetLabel")(x);
			return WtfEngine::String(extract<std::string>(r));
		}catch(const boost::python::error_already_set & e){
			PyErr_Print();
		};
	};
	float getValue(int x){
		try{
			object r = this->get_override("GetValue")(x);
			return extract<float>(r);
		}catch(const boost::python::error_already_set & e){
			PyErr_Print();
		};
	};

	GC_AUTOSIZE(GraphDataWrapper);
};


/**
 * Exports the WtfGui namespace.
 **/
BOOST_PYTHON_MODULE(WtfGui)
{
	/**** Font ****/
	
	class_<Font, Font::tCacheRef, bases<WtfEngine::Texture>, boost::noncopyable>("FontData",
		init<const String&>())
		.def(init<const String&, float>())
		.def(init<const String&, float, const fVector4D&>())
	;
	DECL_CACHE_REF("FontRef", Font, WtfEngine::Texture);

	class_<tFont, tFont::tRef, bases<WtfEngine::IDataObject>, boost::noncopyable>("FontSetting",
		init<const String&, const char*>())
		.def(init<const String&, Font::tRef>())
		.def_readwrite("value", &tFont::Value)
	;
	implicitly_convertible<tFont::tRef, WtfEngine::IDataObject::tCacheRef>();

	class_<ScriptSettingWrapper<tFont> >("Font", init<String>())
		.add_property("value", &ScriptSettingWrapper<tFont>::Get<String>, &ScriptSettingWrapper<tFont>::operator =<tConstString>)
		.def("Set", &ScriptSettingWrapper<tFont>::Set<tConstString>)
		.staticmethod("Set")
	;
	implicitly_convertible<ScriptSettingWrapper<tFont>, tFont::tRef>();
	
	
	/**** Widget Base Classes ****/
	
	class_<Colour, Colour::tRef, bases<WtfEngine::IDataObject>, boost::noncopyable>("ColourSetting",
		init<String, fVector4D>())
		.add_property("value", &Colour::getValue, (void (Colour::*)(const fVector4D&))&Colour::operator =)
		.def("interpolate", &Colour::Interpolate)
	;
	class_<ScriptSettingWrapper<Colour> >("Colour", init<String>())
		.add_property("value", &ScriptSettingWrapper<Colour>::Get<fVector4D>, &ScriptSettingWrapper<Colour>::operator =<fVector4D>)
		.def("Set", &ScriptSettingWrapper<Colour>::Set<fVector4D>)
		.staticmethod("Set")
	;
	implicitly_convertible<ScriptSettingWrapper<Colour>,Colour::tRef>();
	

	class_<Widget::IBackground, Widget::IBackground::tRef, boost::noncopyable>("IWidgetBackground", no_init)
	;
	
	class_<Widget::tBackground, Widget::tBackground::tRef, bases<WtfEngine::IDataObject>, boost::noncopyable>("BackgroundSetting",
		init<String, Widget::IBackground::tRef>())
		.def_readwrite("value", &Widget::tBackground::Value)
	;
	class_<ScriptSettingWrapper<Widget::tBackground> >("Background", init<String>())
		.add_property("value", &ScriptSettingWrapper<Colour>::Get<fVector4D>, &ScriptSettingWrapper<Colour>::operator =<fVector4D>)
		.def("Set", &ScriptSettingWrapper<Colour>::Set<fVector4D>)
		.staticmethod("Set")
	;
	implicitly_convertible<ScriptSettingWrapper<Widget::tBackground>,Widget::tBackground::tRef>();
	
	class_<Widget::NoBackground, Widget::NoBackground::tRef, bases<Widget::IBackground>, boost::noncopyable>("NoBackground")
	;
	implicitly_convertible<Widget::NoBackground::tRef,Widget::IBackground::tRef>();
	class_<Widget::ColourBackground::tCreationOptions>("ColourBackgroundCreationOptions")
		.def_readwrite("colour", &Widget::ColourBackground::tCreationOptions::rColour)
	;
	class_<Widget::ColourBackground, Widget::ColourBackground::tRef, bases<Widget::IBackground> >("ColourBackground",
		init<const Widget::ColourBackground::tCreationOptions&>())
		.add_property("colour", make_function(&Widget::ColourBackground::getColour, return_value_policy<copy_const_reference>()), &Widget::ColourBackground::setColour)
	;
	implicitly_convertible<Widget::ColourBackground::tRef,Widget::IBackground::tRef>();

	class_<IWidgetLayout, IWidgetLayout::tRef, bases<WtfEngine::IObservable>, boost::noncopyable>("IWidgetLayout", no_init)
	;
	class_<WidgetLayout<>, WidgetLayout<>::tRef>("DefaultWidgetLayout");
	implicitly_convertible<WidgetLayout<>::tRef, IWidgetLayout::tRef>();
	class_<WidgetLayout<InterpolatedWidgetVector, InterpolatedWidgetVector>, WidgetLayout<InterpolatedWidgetVector, InterpolatedWidgetVector>::tRef>("InterpolatedWidgetLayout");
	implicitly_convertible<WidgetLayout<>::tRef, IWidgetLayout::tRef>();
	class_<WidgetLayout<WidgetVector, InterpolatedWidgetVector>, WidgetLayout<WidgetVector, InterpolatedWidgetVector>::tRef>("InterpolatedPositionWidgetLayout");
	implicitly_convertible<WidgetLayout<>::tRef, IWidgetLayout::tRef>();
	class_<WidgetLayout<WidgetVector, WidgetVector>, WidgetLayout<WidgetVector, WidgetVector>::tRef>("BasicWidgetLayout");
	implicitly_convertible<WidgetLayout<>::tRef, IWidgetLayout::tRef>();


	class_<AbstractWidget, GcReference<AbstractWidget>, boost::noncopyable >("AbstractWidget", no_init)
		.add_property("layout", make_function(&Widget::getLayout, return_value_policy<copy_const_reference>()), &Widget::setLayout)
		.add_property("size", make_function(&Widget::getSize, return_value_policy<copy_const_reference>()), (void (Widget::*)(const iVector2D&))&Widget::Resize)
		.add_property("innerSize", &Widget::getInnerSize, &Widget::setInnerSize)
		.add_property("position", make_function(&Widget::getPosition, return_value_policy<copy_const_reference>()), (void (Widget::*)(const iVector2D&))&Widget::Move)
	;

	class_<Widget, GcReference<Widget>, bases<AbstractWidget> >("Widget", no_init)
		.add_property("background", make_function(&Widget::getBackground, return_value_policy<copy_const_reference>()), &Widget::setBackground)
		.add_property("padding", &Widget::getPadding2D<0>, &Widget::setPadding2D<0>)
		.add_property("paddingRB", &Widget::getPadding2D<1>, &Widget::setPadding2D<1>)
		.def("Move", (void (Widget::*)(int, int))&Widget::Move)
		.def("Resize", (void (Widget::*)(int, int))&AbstractWidget::Resize)
		.def("SetFgColour", (void (Widget::*)(Colour::tRef, bool))&Widget::SetFgColour)
		.def("Remove", &Widget::Remove)
	;
	implicitly_convertible<GcReference<Widget>,GcReference<AbstractWidget> >();

	class_<WidgetWrapper, GcReference<WidgetWrapper>, bases<AbstractWidget> >("WidgetWrapper",
				init<AbstractWidget*>())
		.add_property("widget", &WidgetWrapper::getWidget)
	;
	implicitly_convertible<GcReference<WidgetWrapper>,GcReference<AbstractWidget> >();

	class_<WidgetContainer, GcReference<WidgetContainer>, bases<Widget> >("WidgetContainer",
				init<tString>())
			.def("AddChild", &WidgetContainer::AddChild)
			.def("RemoveChild", &WidgetContainer::RemoveChild)
			.def("HasChild", &WidgetContainer::HasChild)
			.def("Clear", &WidgetContainer::Clear)
			.def("SendToFront", &WidgetContainer::SendToFront)
			.def("SendToBack", &WidgetContainer::SendToBack)
			.def("Select", (void (WidgetContainer::*)(Widget::tRef, bool))&WidgetContainer::Select)
	;
	implicitly_convertible<GcReference<WidgetContainer>,GcReference<Widget> >();
	
	
	/**** Basic Widgets ****/
	
	class_<Widgets::Label, GcReference<Widgets::Label>, bases<Widget> >("Label", 
				init<String, const tFont::tRef&>())
			.add_property("caption", make_function(&Widgets::Label::getCaption, return_value_policy<copy_const_reference>()), &Widgets::Label::setCaption)
			.add_property("font", make_function(&Widgets::Label::getFont, return_value_policy<copy_const_reference>()), &Widgets::Label::setFont)
			.def("ExpandToText", &Widgets::Label::ExpandToText)
			.def("SetCaption", &Widgets::Label::setCaption)
	;
	implicitly_convertible<GcReference<Widgets::Label>,GcReference<Widget> >();
	
	class_<Widgets::Button, GcReference<Widgets::Button>, bases<Widgets::Label> >("Button", 
				init<Functor::tRef, tString, const tFont::tRef&>())
	;
	implicitly_convertible<GcReference<Widgets::Button>,GcReference<Widget> >();
	
	class_<Widgets::InputField, GcReference<Widgets::InputField>, bases<Widget> >("InputField", 
				init<tFont::tRef>())
			.add_property("text", &Widgets::InputField::getText, &Widgets::InputField::setText)
	;
	implicitly_convertible<GcReference<Widgets::InputField>,GcReference<Widget> >();
	
	class_<Widgets::LogField, GcReference<Widgets::LogField>, bases<Widget> >("LogField", 
				init<int, const tFont::tRef&>())
			.def("Dump", (void (Widgets::LogField::*)(const String&))&Widgets::LogField::Dump)
			.def("Append", (void (Widgets::LogField::*)(const String&))&Widgets::LogField::Append)
			.def("Clear", &Widgets::LogField::Clear)
	;
	implicitly_convertible<GcReference<Widgets::LogField>,GcReference<Widget> >();
	
	class_<Widgets::Image, GcReference<Widgets::Image>, bases<Widget> >("Image",
		init<const WtfEngine::Texture::tCacheRef&>())
		.add_property("src", &Widgets::Image::getImage, &Widgets::Image::setImage)
	;
	implicitly_convertible<GcReference<Widgets::Image>,GcReference<Widget> >();
	

	/**** Windows & Window Manager ****/
	
	class_<Window, GcReference<Window>, bases<WidgetContainer> >("Window", 
				init<const String&>())
			
	;
	implicitly_convertible<GcReference<Window>,GcReference<WidgetContainer> >();
	
	class_<ScreenOverlay, GcReference<ScreenOverlay>, bases<WidgetContainer> >("ScreenOverlay", init<>())
		.def("Init", &ScreenOverlay::Init)
		.def("AddWindow", (void (ScreenOverlay::*)(const Window::tRef&, bool))&ScreenOverlay::AddWindow)
	;
	implicitly_convertible<GcReference<ScreenOverlay>,GcReference<WidgetContainer> >();

	class_<WindowManager, GcReference<WindowManager>, bases<ScreenOverlay> >("WindowManager", 
				init<>())
			.def("BindToEvent", &WindowManager::BindToEvent)
			.def("WmToggle", &WindowManager::WmToggle)
			.def("SpawnConsole", &WindowManager::Spawn<Console>)
	;
	implicitly_convertible<GcReference<WindowManager>,GcReference<ScreenOverlay> >();
	
	
	/**** Layout ****/

	class_<AdvancedLayout::LayoutRule, AdvancedLayout::LayoutRule::tRef>("LayoutRule", init<>())
		.def(init<const AdvancedLayout::LayoutRule::tRef&>())
		.def("Then", &AdvancedLayout::LayoutRule::Then)
	;
	class_<AdvancedLayout, AdvancedLayout::tRef>("AutoLayout", init<const IWidgetLayout::tRef&,
		const AdvancedLayout::LayoutRule::tRef&,const AdvancedLayout::LayoutRule::tRef&,
		const AdvancedLayout::LayoutRule::tRef&,const AdvancedLayout::LayoutRule::tRef&>())
		.def("Destroy", &AdvancedLayout::Destroy)

		.def("Default", &AdvancedLayout::Default)
		.staticmethod("Default")
		.def("PositionAfter", &AdvancedLayout::PositionAfter)
		.staticmethod("PositionAfter")
		.def("SizeAdd", &AdvancedLayout::SizeAdd)
		.staticmethod("SizeAdd")
		.def("InnerSizeAdd", &AdvancedLayout::InnerSizeAdd)
		.staticmethod("InnerSizeAdd")
		.def("InnerSizeScale", &AdvancedLayout::InnerSizeScale)
		.staticmethod("InnerSizeScale")
	;

	class_<AdvancedLayout::Displacement, AdvancedLayout::Displacement::tRef, bases<AdvancedLayout::LayoutRule> >("LRDisplacement", init<int>())
		.def(init<int, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::Displacement::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::Scale, AdvancedLayout::Scale::tRef, bases<AdvancedLayout::LayoutRule> >("LRScale", init<float>())
		.def(init<float, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::Scale::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::SizeOf, AdvancedLayout::SizeOf::tRef, bases<AdvancedLayout::LayoutRule> >("LRSizeOf", init<const IWidgetLayout::tRef&>())
		.def(init<const IWidgetLayout::tRef&, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::SizeOf::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::InnerSizeOf, AdvancedLayout::InnerSizeOf::tRef, bases<AdvancedLayout::LayoutRule> >("LRInnerSizeOf", init<const IWidgetLayout::tRef&>())
		.def(init<const IWidgetLayout::tRef&, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::InnerSizeOf::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::PositionOf, AdvancedLayout::PositionOf::tRef, bases<AdvancedLayout::LayoutRule> >("LRPositionOf", init<const IWidgetLayout::tRef&>())
		.def(init<const IWidgetLayout::tRef&, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::PositionOf::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::Subtract, AdvancedLayout::Subtract::tRef, bases<AdvancedLayout::LayoutRule> >("LRSubtract", init<const AdvancedLayout::LayoutRule::tRef&>())
		.def(init<const AdvancedLayout::LayoutRule::tRef&, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::Subtract::tRef, AdvancedLayout::LayoutRule::tRef>();

	class_<AdvancedLayout::Add, AdvancedLayout::Add::tRef, bases<AdvancedLayout::LayoutRule> >("LRAdd", init<const AdvancedLayout::LayoutRule::tRef&>())
		.def(init<const AdvancedLayout::LayoutRule::tRef&, const AdvancedLayout::LayoutRule::tRef&>())
	;
	implicitly_convertible<AdvancedLayout::Add::tRef, AdvancedLayout::LayoutRule::tRef>();



	class_<LayoutContainer::LayoutContainerCreationOptions>("LayoutContainerCreationOptions")
		.def_readwrite("elementSpacing", &LayoutContainer::LayoutContainerCreationOptions::iElementSpacing)
		.def_readwrite("minSize", &LayoutContainer::LayoutContainerCreationOptions::iMinSize)
		.def_readwrite("maxSize", &LayoutContainer::LayoutContainerCreationOptions::iMaxSize)
		.def_readwrite("wrap", &LayoutContainer::LayoutContainerCreationOptions::bWrap)
	;

	class_<LayoutContainer, GcReference<LayoutContainer>, bases<WidgetContainer> >("LayoutContainer", 
			init<const LayoutContainer::tCreationOptions&, int>())
		
	;
	implicitly_convertible<GcReference<LayoutContainer>,GcReference<WidgetContainer> >();

	class_<ScrollLayout::ScrollLayoutCreationOptions>("ScrollLayoutCreationOptions")
		.def_readwrite("wheelScrollStep", &ScrollLayout::ScrollLayoutCreationOptions::WheelScrollStep)
	;

	class_<ScrollLayout, GcReference<ScrollLayout>, bases<LayoutContainer> >("ScrollLayout", 
			init<const ScrollLayout::tCreationOptions&, int>())
		
	;
	implicitly_convertible<GcReference<ScrollLayout>,GcReference<LayoutContainer> >();


	class_<LayoutPositioner, GcReference<LayoutPositioner>, bases<WidgetWrapper> >("LayoutPositioner", 
			init<AbstractWidget*, const LayoutPositioner::IPositioner::tRef&, const LayoutPositioner::IPositioner::tRef&>())
	;
	implicitly_convertible<GcReference<LayoutPositioner>,GcReference<WidgetWrapper> >();

	// Top positioner
	class_<LayoutPositioner::Top, GcReference<LayoutPositioner::Top> >("TopPositioner", init<>())
		.def(init<int>());
	implicitly_convertible<GcReference<LayoutPositioner::Top>, LayoutPositioner::IPositioner::tRef>();
	// Bottom
	class_<LayoutPositioner::Bottom, GcReference<LayoutPositioner::Bottom> >("BottomPositioner", init<>())
		.def(init<int>());
	implicitly_convertible<GcReference<LayoutPositioner::Bottom>, LayoutPositioner::IPositioner::tRef>();
	// Left
	class_<LayoutPositioner::Left, GcReference<LayoutPositioner::Left> >("LeftPositioner", init<>())
		.def(init<int>());
	implicitly_convertible<GcReference<LayoutPositioner::Left>, LayoutPositioner::IPositioner::tRef>();
	// Right
	class_<LayoutPositioner::Right, GcReference<LayoutPositioner::Right> >("RightPositioner", init<>())
		.def(init<int>());
	implicitly_convertible<GcReference<LayoutPositioner::Right>, LayoutPositioner::IPositioner::tRef>();

	// Centre positioner
	class_<LayoutPositioner::Centre, GcReference<LayoutPositioner::Centre> >("CentrePositioner", init<>())
		.def(init<int>());
	implicitly_convertible<GcReference<LayoutPositioner::Centre>, LayoutPositioner::IPositioner::tRef>();


	class_<LayoutHider::LayoutHiderCreationOptions, bases<LayoutContainer::tCreationOptions> >("LayoutHiderCreationOptions")
	;
	class_<LayoutHider, GcReference<LayoutHider>, bases<LayoutContainer> >("LayoutHider",
		init<const LayoutHider::tCreationOptions&, int, AbstractWidget::tRefa>())
		.def("Show", &LayoutHider::Show)
		.def("Hide", &LayoutHider::Hide)
		.def("Toggle", &LayoutHider::Toggle)
	;
	implicitly_convertible<GcReference<LayoutHider>, LayoutContainer::tRef>();


	/**** Forms ****/

	class_<Forms::Button, GcReference<Forms::Button>, bases<LayoutContainer> >("ButtonEx",
		init<const LayoutContainer::tCreationOptions&, int>())
		.def(init<const LayoutContainer::tCreationOptions&>())
		.add_property("onPress", make_function(&Forms::Button::getOnPress, return_value_policy<copy_const_reference>()), &Forms::Button::setOnPress)
		.add_property("onRightClick", make_function(&Forms::Button::getOnRightClick, return_value_policy<copy_const_reference>()), &Forms::Button::setOnRightClick)
		.add_property("onMouseOver", make_function(&Forms::Button::getOnMouseOver, return_value_policy<copy_const_reference>()), &Forms::Button::setOnMouseOver)
		.add_property("onMouseOut", make_function(&Forms::Button::getOnMouseOut, return_value_policy<copy_const_reference>()), &Forms::Button::setOnMouseOut)
	;
	implicitly_convertible<GcReference<Forms::Button>, GcReference<LayoutContainer> >();

	class_<Forms::Slider, Forms::Slider::tRef, bases<WidgetContainer, WtfEngine::IObservable> >("Slider",
		init<int, float, float, float, float>())
		.add_property("min", &Forms::Slider::getMin, &Forms::Slider::setMin)
		.add_property("max", &Forms::Slider::getMax, &Forms::Slider::setMax)
		.add_property("value", &Forms::Slider::getValue, &Forms::Slider::setValue)
		.add_property("snap", &Forms::Slider::getSnap, &Forms::Slider::setSnap)
	;
	implicitly_convertible<Forms::Slider::tRef, GcReference<WidgetContainer> >();

	class_<Forms::Table::Heading>("TableHeading", init<float, const Widget::tRef&>());

	class_<Forms::Table, GcReference<Forms::Table>, bases<LayoutContainer> >("Table",
		init<const Forms::Table::tCreationOptions&, int>())
		.def(init<const Forms::Table::tCreationOptions&>())
		.def("AddHeading", &Forms::Table::AddHeading)
		.def("SetHeading", &Forms::Table::setHeading)
		.def("AddRecord", &Forms::Table::AddRecord)
	;
	implicitly_convertible<GcReference<Forms::Table>, GcReference<LayoutContainer> >();


	/**** Misc Widgets ****/
	
	class_<Widgets::Popup, GcReference<Widgets::Popup>, bases<WidgetContainer> >("PopupWidget", init<const Widget::tRef&>())
	;
	implicitly_convertible<GcReference<Widgets::Popup>, GcReference<WidgetContainer> >();

	class_<Widgets::ColourPicker, GcReference<Widgets::ColourPicker>, bases<Widget> >("ColourPicker")
		.add_property("selectedColour", make_function(&Widgets::ColourPicker::getSelectedColour, return_value_policy<copy_const_reference>()))
	;
	implicitly_convertible<GcReference<Widgets::ColourPicker>, GcReference<Widget> >();


	/**** Menus ****/
	
	class_<Widgets::Menu, GcReference<Widgets::Menu>, bases<LayoutContainer> >("Menu", 
			init<const String&>())
			
	;
	implicitly_convertible<GcReference<Widgets::Menu>,GcReference<LayoutContainer> >();


	/**** Dialogs ****/

	

	/**** Graphs ****/

	class_<GraphDataWrapper, GraphDataWrapper::tRef, bases<WtfEngine::IObservable>, boost::noncopyable>("GraphDataProvider")
		.def("GetNumValues", pure_virtual(&GraphDataWrapper::getNumValues))
		.def("GetLabel", pure_virtual(&GraphDataWrapper::getLabel))
		.def("GetValue", pure_virtual(&GraphDataWrapper::getValue)) 
	;
	implicitly_convertible<GraphDataWrapper::tRef, IGraphData::tRef>();

	class_<Axes::GraphEntry>("GraphEntry", init<const IGraphData::tRef&>())
		.def(init<const IGraphData::tRef&, const fVector4D&>())
		.def_readwrite("colour", &Axes::GraphEntry::vColour)
	;


	/*class_<ValueFormatterWrapper, ValueFormatterWrapper::tRef>("ValueFormatter", init<object>())
	;
	implicitly_convertible<ValueFormatterWrapper::tRef, Axes::tValueFormatter::tRef>();*/

	class_<Axes, Axes::tRef, bases<Widget>, boost::noncopyable >("Axes", no_init)
		.def("AddGraph", &Axes::AddGraph)
		.def("RemoveGraph", &Axes::RemoveGraph)
//		.def("SetValueFormatter", &Axes::setValueFormatter)
	;
	implicitly_convertible<Axes::tRef, Widget::tRef>();

	class_<LineGraph, LineGraph::tRef, bases<Axes> >("LineGraph", init<const String&, const String&>())
	;
	implicitly_convertible<LineGraph::tRef, Axes::tRef>();



	/**** Scene Rendering ****/

	class_<WtfGui::Scene, WtfGui::Scene::tRef, bases<Widget> >("Scene",
		init<const ICamera::tRef&, const iVector2D&>())
		.def("Update", &WtfGui::Scene::Update)
		.add_property("update", &WtfGui::Scene::getUpdate, &WtfGui::Scene::setUpdate)
		.add_property("frameBuffer", &WtfGui::Scene::getFrameBuffer)
		.add_property("camera", &WtfGui::Scene::getCamera, &WtfGui::Scene::setCamera)
	;
	implicitly_convertible<WtfGui::Scene::tRef, GcReference<Widget> >();

	class_<SceneDiagnostics, WtfGui::SceneDiagnostics::tRef, bases<Window> >("SceneDiagnostics")
	;
	implicitly_convertible<SceneDiagnostics::tRef, GcReference<Window> >();
};

void WtfGui::ExportToScripting() {
	initWtfGui();
};

